package com.shujia.flink.tf;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Demo07Union {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<String> ds01 = env.socketTextStream("master", 8888);
        DataStream<String> ds02 = env.socketTextStream("master", 9999);

        DataStream<String> unionDS = ds01.union(ds02);

        // union 就是将两个相同结构的DS合并成一个DS
        unionDS.print();

        env.execute();

    }
}
